<?php
class groups
{	
	private static function getNameGroup($parent_param = false)
	{
		$r =& Registry::get("MDB")->query("SELECT `Name` FROM `".DB_STRUCTURE."` WHERE `id`='".($parent_param ? $parent_param : $_GET["parent"])."' LIMIT 1;");
		if (PEAR::isError($r)) {
			die($r->getMessage().' ::: '.$r->getUserInfo());
		}
		if($r->numRows())
		{
			$p = $r->fetchRow(MDB2_FETCHMODE_ASSOC);
			return $p["name"];
		}
	}
	
	public static function get($table, $parent_param = false)
	{		
		Registry::get("smarty")->assign(array(
			'table' => $table,
			'curr_name' => groups::getNameGroup($parent_param)
		));
		return Registry::get("smarty")->fetch(TEMPLATE_ADMIN."groups_modal.list.tpl", Registry::get("cache_id"));
	}
}
?>